package com.vincent.dao;

import com.vincent.model.Article;
import com.vincent.model.ArticleWithBLOBs;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("articleMapper")
public interface ArticleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(ArticleWithBLOBs record);

    int insertSelective(ArticleWithBLOBs record);

    ArticleWithBLOBs selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ArticleWithBLOBs record);

    int updateByPrimaryKeyWithBLOBs(ArticleWithBLOBs record);

    int updateByPrimaryKey(Article record);

    List<Integer> selectTopByCategory(@Param("categoryId") int categoryId, @Param("num") int num, @Param("isPublication") boolean isPublication);

    List<Integer> selectIdPagination(@Param("startIndex") int startIndex, @Param("pageSize") int pageSize, @Param("categoryId") Integer categoryId, @Param("isPublication") Boolean isPublication);

    Integer selectIdPaginationNum(@Param("categoryId") Integer categoryId, @Param("isPublication") Boolean isPublication);

    List<Integer> selectHotestArticles(@Param("categoryId") int categoryId, @Param("num") int num, @Param("isPublication") boolean isPublication);

    int deleteArticles(@Param("ids") Integer []ids);
}